package com.hlhj.carview.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.hlhj.carview.Iview.IdentityView
import com.hlhj.carview.bean.MyBaseBean
import com.hlhj.carview.http.Apis
import com.hlhj.carview.http.CustomAction
import com.hlhj.carview.http.LoadingAction
import com.lzy.okgo.model.Response

/**
 * Created by Never Fear   on 2018\12\20 0020.
Never More....
 */
class IdentityModule :BaseModule {
    var listener:IdentityView?=null


    fun indentify(id_front:String,id_back:String,travel_front:String,travel_back:String,driving_front:String,driving_back:String,c:Context){
        Apis?.identify(id_front, id_back, travel_front, travel_back, driving_front, driving_back)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<MyBaseBean>>(c){
                                override fun httpSuccess(t: Response<MyBaseBean>) {
                                    listener?.setCommitResult(t.body())
                                }
                            })
                }
    }
}